class Solution {
public:
	int minCostClimbingStairs(vector<int>& cost) {
		int mincost = 0;
		int last = cost[1];
		int lastlast = cost[0];
		int temp = 0;
		for (size_t i = 2; i < cost.size(); i++)
		{	
			mincost = min(last, lastlast + cost[i]);
			temp = lastlast;
			lastlast = last;
			last = min(last , temp)+cost[i];
		}

		return mincost;
	}
};